using System;
using UnityEngine;
using QFramework;

namespace ProjectSurvival
{
	public partial class FxController : ViewController
	{
		public static FxController instance;
		void Start()
		{
			if (instance==null)
			{
				instance = this;
			}
		}

		private void OnDestroy()
		{
			instance = null;
		}

		public void Play(SpriteRenderer sprite, Color color)
		{
			var enemyDiefx = instance.EnemyDieFX.Instantiate();
			enemyDiefx.Position(sprite.Position());
			enemyDiefx.LocalScale(sprite.Scale());
			enemyDiefx.GetComponent<Dissolve>().DissolveColor = color;
			enemyDiefx.sprite = sprite.sprite;
			enemyDiefx.Show();
		}
	}
}
